#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int t;
	cin >> t;

	double male, female;
	male = female = 0;

	int num_male, num_female;
	num_male = num_female = 0;

	for (int i = 1; i <= t; i++) {
		string s, t;
		int x;
		cin >> s >> t >> x;
		if (t == "M")
			male += x, num_male++;
		else
			female += x, num_female++;

	}

	cout << fixed << setprecision(1) << (male + female) / t << " ";
	if (num_male)
		cout << fixed << setprecision(1) << male / num_male;
	else
		cout << "X";
	cout << " ";
	if (num_female)
		cout << fixed << setprecision(1) << female / num_female;
	else
		cout << "X";
	return 0;
}
